package com.osfw.activiti.enums;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 流程会签方案
 */
public enum ProcConcurrentPlan {
    NON(0, "非会签"),
    ONE_VOTE_PASSED(1, "一票通过"),
    ONE_VOTE_NO(2, "一票否决"),
    MULTIPLE_VOTE_PASSED(3, "多票通过"),
    NO_END_ALL_PASSED(4, "一律通过（非结束节点可选）");

    private Integer code;
    private String name;

    ProcConcurrentPlan(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }


    public static ProcConcurrentPlan getProcConcurrentPlan(Integer code) {
        for (ProcConcurrentPlan palnEnum : values()) {
            if (palnEnum.getCode().intValue() == code.intValue()) {
                return palnEnum;
            }
        }
        return null;
    }

    public static Map<Integer, String> getProcConcurrentPlanList() {
        HashMap<Integer, String> map = new LinkedHashMap<>();
        for (ProcConcurrentPlan palnEnum : values()) {
            map.put(palnEnum.getCode(), palnEnum.getName());
        }
        return map;
    }
}
